﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserView.aspx.cs" Inherits="Directory.Web.Admin_UserView"
    Theme="Admin_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>用户列表</title>

    <script type="text/javascript">
        function $(id) {
            return document.getElementById(id);
        }
        function RefreshPage() {
            window.location.replace(window.location.href);
        }
        function ResetPage() {
            $('userFrame').setAttribute("src", "");
            $('userFrame').style.display = 'none';
        }
        function searchUser(obj) {
            var username = $('searchUserName').value;
            if (username.replace(/(^[\s]*)|([\s]*$)/g, "") == '') {
                alert('请输入用户名。');
                $('searchUserName').value = '';
                return false;
            } else {
                ShowFrame();
                obj.setAttribute("href", "User.aspx?username=" + encodeURI(username) + "&action=modify#user");
                return true;
            }
            return false;
        }
        function ShowFrame() {
            $('userFrame').style.display = '';
            $('loadingState').style.display = '';
        }
        function HideLoadingState() {
            $('loadingState').style.display = 'none';
        }
        function FrameLoaded() {
            HideLoadingState();
            var ifrm = document.getElementById('userFrame');
            var height_doc = parseInt(ifrm.contentWindow.document.body.scrollHeight);
            var height_parnent = parseInt(ifrm.parentNode.offsetHeight);
            if (height_doc > height_parnent) {
                ifrm.style.height = height_doc + 'px';
            } else {
                ifrm.style.height = height_parnent + 'px';
            }
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div class="container">
        <div>
            <div class="pageheader">
                <span style="color: Red;">用户管理</span>
                <%-- 帮助文档 --%>
                <DirectoryControl:Manual runat="server">
                    <table>
                        <col width="30%" style="font-weight: bold;" />
                        <col width="70%" />
                        <tr>
                            <td>
                                CustomRole
                            </td>
                            <td>
                                普通会员角色，所有用户都属于该角色
                            </td>
                        </tr>
                        <tr>
                            <td>
                                CategoryMgr
                            </td>
                            <td>
                                该角色用户可以进行【条目管理】
                            </td>
                        </tr>
                        <tr>
                            <td>
                                RootCategoryMgr
                            </td>
                            <td>
                                该角色目录用户可以在【条目管理】中添、删、编辑一级目录
                            </td>
                        </tr>
                        <tr>
                            <td>
                                SecurityMgr
                            </td>
                            <td>
                                该角色用户可以进行【权限设置】
                            </td>
                        </tr>
                        <tr>
                            <td>
                                SiteSettingsMgr
                            </td>
                            <td>
                                该角色用户可以进行【站点管理】
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="color: Red;">
                                被锁定用户将不能登录网站
                            </td>
                        </tr>
                    </table>
                </DirectoryControl:Manual>
            </div>
        </div>
        <%--<div class="pagecontent">--%>
        选择角色：
        <asp:DropDownList ID="ddlRoles" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlRoles_SelectedIndexChanged">
        </asp:DropDownList>
        &nbsp; &nbsp; 用户名：<input type="text" id="searchUserName" />
        <a onclick="return(searchUser(this))" href='' target="userFrame">快速查找</a>
        <asp:Repeater ID="rptUsers" runat="server">
            <HeaderTemplate>
                <table>
                    <tr>
                        <th>
                            用户名
                        </th>
                        <th>
                            管理操作
                        </th>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr class='<%# Container.ItemIndex%2==0? "tr_bg":"" %>'>
                    <td>
                        <%# Container.DataItem %>
                    </td>
                    <td>
                        <a href="User.aspx?username=<%# Server.UrlEncode(Container.DataItem.ToString()) %>&action=modify"
                            target="userFrame">编辑</a> <a onclick="return(window.confirm('确认删除该用户吗？'))" href="User.aspx?username=<%# Server.UrlEncode(Container.DataItem.ToString()) %>&action=delete"
                                target="userFrame">删除</a>
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </table></FooterTemplate>
        </asp:Repeater>
        <Admin:PageBreak runat="server" ID="PageBreak" />
        <div id="loadingState" style="display: none;">
        </div>
        <iframe id="userFrame" name="userFrame" frameborder="0" style="display: none;" onload="FrameLoaded();">
        </iframe>
        <%--</div>--%>
    </div>

    <script type="text/javascript">
        var links = document.getElementsByTagName("A");
        for (var i = 0; i < links.length; i++) {
            if (links[i].getAttribute("target") == $('userFrame').getAttribute("name")) {
                if (links[i].onclick == null) {
                    links[i].onclick = ShowFrame;
                } else {
                }
            }
        }
    </script>

    </form>
</body>
</html>
